<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Create a new ReadConcern</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="mongodb-driver-readconcern.bsonserialize.html">« MongoDB\Driver\ReadConcern::bsonSerialize</a></li>
      <li style="float: right;"><a href="mongodb-driver-readconcern.getlevel.html">MongoDB\Driver\ReadConcern::getLevel »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.mongodb-driver-readconcern.html">MongoDB\Driver\ReadConcern</a></li>
    <li>Create a new ReadConcern</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="mongodb-driver-readconcern.construct" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">MongoDB\Driver\ReadConcern::__construct</h1>
  <p class="verinfo">(mongodb &gt;=1.0.0)</p><p class="refpurpose"><span class="refname">MongoDB\Driver\ReadConcern::__construct</span> &mdash; <span class="dc-title">Create a new ReadConcern</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-mongodb-driver-readconcern.construct-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">final</span> <span class="modifier">public</span> <span class="methodname"><strong>MongoDB\Driver\ReadConcern::__construct</strong></span>(<span class="methodparam"><span class="type">?</span><span class="type"><span class="type">string</span><span class="type"></span></span> <code class="parameter">$level</code><span class="initializer"> = <strong><code>null</code></strong></span></span>)</div>

  <p class="para rdfs-comment">
   Constructs a new <span class="classname"><a href="class.mongodb-driver-readconcern.html" class="classname">MongoDB\Driver\ReadConcern</a></span>, which is
   an immutable value object.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-mongodb-driver-readconcern.construct-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt>
<code class="parameter">level</code></dt>

    <dd>

     <p class="para">
      The <a href="https://www.mongodb.com/docs/manual/reference/read-concern/#read-concern-levels" class="link external">&raquo;&nbsp;read concern level</a>.
      You may use, but are not limited to, one of the
      <a href="class.mongodb-driver-readconcern.html#mongodb-driver-readconcern.constants" class="link">class constants</a>.
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 errors" id="refsect1-mongodb-driver-readconcern.construct-errors">
  <h3 class="title">错误／异常</h3>
  <ul class="simplelist">
   <li class="member">Throws <span class="classname"><a href="class.mongodb-driver-exception-invalidargumentexception.html" class="classname">MongoDB\Driver\Exception\InvalidArgumentException</a></span> on argument parsing errors.</li>
  </ul>
 </div>



 <div class="refsect1 examples" id="refsect1-mongodb-driver-readconcern.construct-examples">
  <h3 class="title">范例</h3>
  <div class="example" id="example-1334">
   <p><strong>示例 #1 <span class="function"><strong>MongoDB\Driver\ReadConcern::__construct()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">/*&nbsp;Unspecified&nbsp;read&nbsp;isolation&nbsp;level&nbsp;(uses&nbsp;the&nbsp;server's&nbsp;default&nbsp;behavior)&nbsp;*/<br /></span><span style="color: #0000BB">$rc&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">MongoDB</span><span style="color: #007700">\</span><span style="color: #0000BB">Driver</span><span style="color: #007700">\</span><span style="color: #0000BB">ReadConcern</span><span style="color: #007700">();<br /><br /></span><span style="color: #FF8000">/*&nbsp;Request&nbsp;read&nbsp;isolation&nbsp;from&nbsp;a&nbsp;single&nbsp;replica&nbsp;set&nbsp;node&nbsp;*/<br /></span><span style="color: #0000BB">$rc&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">MongoDB</span><span style="color: #007700">\</span><span style="color: #0000BB">Driver</span><span style="color: #007700">\</span><span style="color: #0000BB">ReadConcern</span><span style="color: #007700">(</span><span style="color: #0000BB">MongoDB</span><span style="color: #007700">\</span><span style="color: #0000BB">Driver</span><span style="color: #007700">\</span><span style="color: #0000BB">ReadConcern</span><span style="color: #007700">::</span><span style="color: #0000BB">LOCAL</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/*&nbsp;Request&nbsp;read&nbsp;isolation&nbsp;from&nbsp;a&nbsp;majority&nbsp;of&nbsp;the&nbsp;replica&nbsp;set&nbsp;nodes&nbsp;*/<br /></span><span style="color: #0000BB">$rc&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">MongoDB</span><span style="color: #007700">\</span><span style="color: #0000BB">Driver</span><span style="color: #007700">\</span><span style="color: #0000BB">ReadConcern</span><span style="color: #007700">(</span><span style="color: #0000BB">MongoDB</span><span style="color: #007700">\</span><span style="color: #0000BB">Driver</span><span style="color: #007700">\</span><span style="color: #0000BB">ReadConcern</span><span style="color: #007700">::</span><span style="color: #0000BB">MAJORITY</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

  </div>
 </div>



 <div class="refsect1 seealso" id="refsect1-mongodb-driver-readconcern.construct-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li class="member"><a href="https://www.mongodb.com/docs/manual/reference/read-concern/" class="link external">&raquo;&nbsp;Read Concern reference</a></li>
  </ul>
 </div>


</div></div></div></body></html>